package com.mobi.cacti.rabbit.response;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;


import android.util.Log;

public class ReqCustomerServiceInfoHandler extends DefaultHandler {
	private String tempVal;
	private ReqCustomerServiceInfo oClass;
	
	private CustomerInfoCurcitData customerInforCurcitData;

	public ReqCustomerServiceInfoHandler() {}

	public ReqCustomerServiceInfo getObj() {
		return oClass;
	}

	//set result_code_data id of tag
	public void startElement(String uri, String localName, String qName,Attributes attributes) throws SAXException {
		// reset
		
		tempVal = "";
		if (localName.equalsIgnoreCase("ReqW4CusInfo")) {
			oClass = new ReqCustomerServiceInfo(); //create object class
			oClass.initLinked();
		}
		else if(localName.equalsIgnoreCase("CircuitID"))
		{
			customerInforCurcitData = new CustomerInfoCurcitData();
			customerInforCurcitData.id = attributes.getValue("id");
//			Log.i("tai","curcuit start"+localName);
		}
	}

	public void characters(char[] ch, int start, int length) throws SAXException {
		tempVal = new String(ch, start, length);
	}

	public void endElement(String uri, String localName, String qName) throws SAXException 
	{
		if (qName.equalsIgnoreCase("ReqSessionID")){
			oClass.ReqSessionID = tempVal;
		}else if (qName.equalsIgnoreCase("ResSessionID")){	
			oClass.ResSessionID = tempVal;
		}else if (qName.equalsIgnoreCase("ComNameE")){
			oClass.ComNameE = tempVal;
		}else if (qName.equalsIgnoreCase("ComNameT")){	
			oClass.ComNameT = tempVal;
		}else if (qName.equalsIgnoreCase("ComTel")){	
			oClass.ComTel = tempVal;
		}else if (qName.equalsIgnoreCase("ComEmail")){	
			oClass.ComEmail = tempVal;
		}else if (qName.equalsIgnoreCase("result_code")){	
			oClass.result_code = tempVal;
		}else if (qName.equalsIgnoreCase("result_desc")){	
			oClass.result_desc = tempVal;
		}else if (qName.equalsIgnoreCase("response_message")){	
			oClass.response_message = tempVal;
		}
		else if (qName.equalsIgnoreCase("BAN")){	
			customerInforCurcitData.ban = tempVal;
		}
		else if (qName.equalsIgnoreCase("ContractNo")){	
			customerInforCurcitData.contractNo = tempVal;
		}
		else if (qName.equalsIgnoreCase("ContractPeriod")){	
			customerInforCurcitData.contractPeriod = tempVal;
		}
		else if (qName.equalsIgnoreCase("ContactPerName")){	
			customerInforCurcitData.contactPerName = tempVal;
		}
		else if (qName.equalsIgnoreCase("ContactPerEmail")){	
			customerInforCurcitData.contactPerEmail = tempVal;
		}
		else if (qName.equalsIgnoreCase("ContactPerTel")){	
			customerInforCurcitData.contactPerTel = tempVal;
		}
		else if (qName.equalsIgnoreCase("CircuitIDW4")){	
			customerInforCurcitData.circuitIDW4 = tempVal;
		}
		else if (qName.equalsIgnoreCase("InstallationAddress")){	
			customerInforCurcitData.installationAddress = tempVal;
		}
		else if (qName.equalsIgnoreCase("MediaProvider")){	
			customerInforCurcitData.mediaProvider = tempVal;
		}
		else if (qName.equalsIgnoreCase("Package")){	
			customerInforCurcitData.Package = tempVal;
		}
		else if (qName.equalsIgnoreCase("CircuitID")){	
//			Log.i("tai","end curcuit id"+customerInforCurcitData.id);
			oClass.customerInfoCurcitDataMap.put(customerInforCurcitData.id, customerInforCurcitData);
		}
	}

}
